package com.company.admin.common.result;

import com.sun.net.httpserver.Authenticator;

import java.util.List;

/**
 * @author 赵成林
 * @date 2019/2/16 21:27
 */
public class ResultResponse<T> {

    private int code;
    private boolean success;
    private T data;
    private List<T> list;

    public int getCode() {
        return code;
    }

    public boolean isSuccess() {
        return success;
    }

    public T getData() {
        return data;
    }

    public List<T> getList() {
        return list;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public static <T> ResultResponse<T> onSuccess(T data, List<T> list){
        ResultResponse<T> resultResponse = new ResultResponse<>();
        resultResponse.setCode(200);
        resultResponse.setSuccess(true);
        resultResponse.setList(list);
        resultResponse.setData(data);
        return resultResponse;
    }
}
